package com.xy.entity;

import java.util.Date;

import javax.validation.constraints.Min;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;

/**
 * 公司实体类
 * 
 * @author 陈耀
 * @date 2018-2-1
 */

public class Company {
	private int companyID;
	@NotEmpty(message = "{company.companyName.empty}")
	@Length(message = "{company.companyName.lenth}")
	private String companyName;
	// 佣金比例
	// @NotEmpty(message = "{company.financingInReturn.empty}")
	@Min(message = "{company.financingInReturn.min}", value = 0)
	private double financingInReturn;
	@NotEmpty(message = "{company.companyDetail.empty}")
	@Length(message = "{company.companyDetail.max}")
	private String companyDetail;
	private String companyDetailHtml;
	// 图片存储地址
	private String imgURL;
	// 图片名
	private String imgRealName;

	private Date createTime;
	private int createID;

	public int getCompanyID() {
		return companyID;
	}

	public void setCompanyID(int companyID) {
		this.companyID = companyID;
	}

	public String getCompanyName() {
		return companyName;
	}

	public void setCompanyName(String companyName) {
		this.companyName = companyName;
	}

	public Double getFinancingInReturn() {
		return financingInReturn;
	}

	public void setFinancingInReturn(double financingInReturn) {
		this.financingInReturn = financingInReturn;
	}

	public String getCompanyDetail() {
		return companyDetail;
	}

	public void setCompanyDetail(String companyDetail) {
		this.companyDetail = companyDetail;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public int getCreateID() {
		return createID;
	}

	public void setCreateID(int createID) {
		this.createID = createID;
	}

	public String getImgURL() {
		return imgURL;
	}

	public void setImgURL(String imgURL) {
		this.imgURL = imgURL;
	}

	public String getImgRealName() {
		return imgRealName;
	}

	public void setImgRealName(String imgRealName) {
		this.imgRealName = imgRealName;
	}

	public String getCompanyDetailHtml() {
		return companyDetailHtml;
	}

	public void setCompanyDetailHtml(String companyDetailHtml) {
		this.companyDetailHtml = companyDetailHtml;
	}

	/**
	 * 获取企业详情缩减版
	 * 
	 * @return
	 */
	public String getCompanyDetailSubStr() {
		if (companyDetail.length() >= 10) {
			return companyDetail.substring(0, 10) + "......";
		}
		return companyDetail;
	}

	@Override
	public String toString() {
		return "Company [companyDetail=" + companyDetail + ", companyDetailHtml=" + companyDetailHtml + ", companyID=" + companyID + ", companyName=" + companyName + ", createID=" + createID + ", createTime=" + createTime + ", financingInReturn=" + financingInReturn + ", imgRealName=" + imgRealName + ", imgURL=" + imgURL + "]";
	}

}
